/**
 * Created by lx on 2017/6/26.
 */
app.factory('Candy',['$http', function ($http) {
    return {
        getindexsList: function () {
            return $http.get('/api/candy/getindexslist');   //Promise对象 后期通过then来获取success error
        },
        getindexsInfo: function (id) {
            return $http.get('/api/candy/getindexsinfo?id='+id);    //promise
        },
        getsenyongsList: function () {
            return $http.get('/api/candy/getsenyongslist');   //Promise对象 后期通过then来获取success error
        },
        getsenoyngsInfo: function (id) {
            return $http.get('/api/candy/getsenyongsinfo?id='+id);    //promise
        },
        getkoufulaisList: function () {
            return $http.get('/api/candy/getkoufulaislist');   //Promise对象 后期通过then来获取success error
        },
        getkoufulaisInfo: function (id) {
            return $http.get('/api/candy/getkoufulaisinfo?id='+id);    //promise
        },
        getyoumansList: function () {
            return $http.get('/api/candy/getyoumanslist');   //Promise对象 后期通过then来获取success error
        },
        getyoumansInfo: function (id) {
            return $http.get('/api/candy/getyoumansinfo?id='+id) ;   //promise
        },
        //cart
        //获取购物车信息
        getshoppingcartsInfo: function (username) {
            return $http.get('/api/candy/cartinfo?username='+username);
        },
        //增加购物车信息
        addshoppingcartsInfo:function(username,count){
            return $http.get('/api/candy/cartinfo?username='+username+'&count='+count);
        },
        //减少购物车信息
        minusshoppingcartsInfo:function(username,count){
            return $http.get('/api/candy/cartinfo?username='+username+'&count='+count);
        },
        //删除购物车信息
        delshoppingcartsInfo:function(id){
            return $http.get('/api/candy/cartinfo?id='+id);
        }
    }
}]);